home *** CD-ROM | disk | FTP | other *** search
/ Hobby PC 13 / Hobby PC 13.iso / assets / Asset Library / Forms / fxitems.xml < prev    next >
Extensible Markup Language  |  2001-04-09  |  58KB  |  1,724 lines

  1. <?xml version="1.0" standalone="yes"?>
  2.  
  3. <Items>
  4.  
  5. <Item CLASS="TextData" TYPE="TEXT" ID="16">
  6.     <Icon STRING="Self-Validating Form"/>
  7.     <OnBlur VALUE=""/>
  8.     <Title><![CDATA[<B>Complete Form example</B>]]></Title>
  9.     <Description><![CDATA[This form contains a Credit Card validation example. is aware of differences between the US, Canadian, and International forms of phone numbers, State/Province Codes, and Zip/Postal Codes. Radio buttons will toggle.]]></Description>
  10.  
  11.   <SCRIPT LANGUAGE="JSCRIPT"> <![CDATA[
  12.     var dst = ActiveDocument.LocalPath + "\\valid.js";
  13.     var src = "%Pathname%valid.js"
  14.     Application.FX.CopyFile(src,dst);
  15.     Application.FX.HTML("","%Pathname%validate.txt","HEAD","sqValidate");
  16.     Application.FX.HTML("","%Pathname%validform.txt","","sqValidForm");
  17.     Application.FX.HTML("<SCRIPT SRC='valid.js' ID='sqValidator'></SCRIPT>","","HEAD","sqValidator");
  18. //    ]]></SCRIPT>
  19.   </Item>
  20.  
  21.  
  22. <Item CLASS="TextData" TYPE="TEXT" ID="1">
  23.     <Icon STRING="address@domain.com"/>
  24.     <FileName SRC="valid.js"/>
  25.     <OnBlur VALUE="checkEmail(this)"/>
  26.     <Title><![CDATA[<B><I>Email address</I></B>]]></Title>
  27.     <Description><![CDATA[This form-field will accept only a properly-formed email address.</P><P><I>The minimum acceptable email address is: a@b.cd (note that the top-level suffix must have at least two characters)</I>]]></Description>
  28.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  29.     var src, dest, attr, defval;
  30.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  31.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  32.  
  33.     //modify the section below; it is unique to each validating form field
  34.  
  35.     function dropfxnow()
  36.         {
  37.         Selection.TypeText("Email: ");
  38.         Selection.InsertElement("INPUT");
  39.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  40.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkEmail(this)";
  41.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","email");
  42.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  43.         Application.FX.CopyFile(src,dst);
  44.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  45.         }
  46.  
  47.     //modify the section above; it is unique to each validating form field
  48.  
  49.     function istextcontainer()
  50.         {
  51.         var itsatext = 0;
  52.         itsatext = itsatext + Selection.IsParentElement("P");
  53.         itsatext = itsatext + Selection.IsParentElement("H1");
  54.         itsatext = itsatext + Selection.IsParentElement("H2");
  55.         itsatext = itsatext + Selection.IsParentElement("H3");
  56.         itsatext = itsatext + Selection.IsParentElement("H4");
  57.         itsatext = itsatext + Selection.IsParentElement("H5");
  58.         itsatext = itsatext + Selection.IsParentElement("H6");
  59.         itsatext = itsatext + Selection.IsParentElement("PRE");
  60.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  61.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  62.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  63.         itsatext = itsatext + Selection.IsParentElement("DD");
  64.         itsatext = itsatext + Selection.IsParentElement("DL");
  65.         itsatext = itsatext + Selection.IsParentElement("LI");
  66.         itsatext = itsatext + Selection.IsParentElement("LH");
  67.         itsatext = itsatext + Selection.IsParentElement("TD");
  68.         itsatext = itsatext + Selection.IsParentElement("TH");
  69.         return itsatext;
  70.         }
  71.  
  72.     function buildpath()
  73.         {
  74.         if (ActiveDocument.InCurrentProject)
  75.             {
  76.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  77.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  78.             }
  79.         else
  80.             {
  81.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  82.             attr = "scripts/%Filename%";
  83.             }
  84.         }
  85.  
  86.     function prepdrop()
  87.         {
  88.         var isittext;
  89.         Application.FX.SelectDropPoint();
  90.         if (Selection.IsParentElement("FORM") == true)
  91.             {
  92.             if (istextcontainer() == 0)
  93.                 {
  94.                 Application.FX.SelectDropPoint();
  95.                 Selection.InsertElement("P");
  96.                 dropfxnow();
  97.                 }
  98.             else
  99.                 {
  100.                 Application.FX.SelectDropPoint();
  101.                 dropfxnow();
  102.                 }
  103.             }                    
  104.         else
  105.             {
  106.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  107.             }
  108.         }
  109.  
  110.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  111.         {
  112.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  113.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  114.         }
  115.     else
  116.         {
  117.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  118.  
  119.         if (ans == 1)
  120.             {
  121.             ActiveDocument.SaveAs();
  122.             }
  123.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  124.             {
  125.             buildpath();
  126.             prepdrop();
  127.             }
  128.         }
  129.     
  130. //    ]]></SCRIPT>
  131. </Item>
  132.  
  133. <Item CLASS="TextData" TYPE="TEXT" ID="2">
  134.     <Icon STRING="(416) 555-1212"/>
  135.     <OnBlur VALUE="checkUSPhone(this)"/>
  136.     <FileName SRC="valid.js"/>
  137.     <Title><![CDATA[<B><I> North American phone Numbers</I></B>]]></Title>
  138.     <Description><![CDATA[This field will accept only a properly-formed North American phone number. It will also reformat any number entered as (123) 456-7890, throwing away any superfluous delimiters or whitespace.</P>]]></Description>
  139.  
  140.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  141.     var src, dest, attr, defval;
  142.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  143.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  144.  
  145.     //modify the section below; it is unique to each validating form field
  146.  
  147.     function dropfxnow()
  148.         {
  149.         Selection.TypeText("Phone: ");
  150.         Selection.InsertElement("INPUT");
  151.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  152.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkUSPhone(this)";
  153.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","phone");
  154.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  155.         Application.FX.CopyFile(src,dst);
  156.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  157.         }
  158.  
  159.  
  160.     //modify the section above; it is unique to each validating form field
  161.  
  162.     function istextcontainer()
  163.         {
  164.         var itsatext = 0;
  165.         itsatext = itsatext + Selection.IsParentElement("P");
  166.         itsatext = itsatext + Selection.IsParentElement("H1");
  167.         itsatext = itsatext + Selection.IsParentElement("H2");
  168.         itsatext = itsatext + Selection.IsParentElement("H3");
  169.         itsatext = itsatext + Selection.IsParentElement("H4");
  170.         itsatext = itsatext + Selection.IsParentElement("H5");
  171.         itsatext = itsatext + Selection.IsParentElement("H6");
  172.         itsatext = itsatext + Selection.IsParentElement("PRE");
  173.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  174.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  175.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  176.         itsatext = itsatext + Selection.IsParentElement("DD");
  177.         itsatext = itsatext + Selection.IsParentElement("DL");
  178.         itsatext = itsatext + Selection.IsParentElement("LI");
  179.         itsatext = itsatext + Selection.IsParentElement("LH");
  180.         itsatext = itsatext + Selection.IsParentElement("TD");
  181.         itsatext = itsatext + Selection.IsParentElement("TH");
  182.         return itsatext;
  183.         }
  184.  
  185.     function buildpath()
  186.         {
  187.         if (ActiveDocument.InCurrentProject)
  188.             {
  189.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  190.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  191.             }
  192.         else
  193.             {
  194.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  195.             attr = "scripts/%Filename%";
  196.             }
  197.         }
  198.  
  199.     function prepdrop()
  200.         {
  201.         var isittext;
  202.         Application.FX.SelectDropPoint();
  203.         if (Selection.IsParentElement("FORM") == true)
  204.             {
  205.             if (istextcontainer() == 0)
  206.                 {
  207.                 Application.FX.SelectDropPoint();
  208.                 Selection.InsertElement("P");
  209.                 dropfxnow();
  210.                 }
  211.             else
  212.                 {
  213.                 Application.FX.SelectDropPoint();
  214.                 dropfxnow();
  215.                 }
  216.             }                    
  217.         else
  218.             {
  219.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  220.             }
  221.         }
  222.  
  223.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  224.         {
  225.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  226.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  227.         }
  228.     else
  229.         {
  230.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  231.  
  232.         if (ans == 1)
  233.             {
  234.             ActiveDocument.SaveAs();
  235.             }
  236.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  237.             {
  238.             buildpath();
  239.             prepdrop();
  240.             }
  241.         }
  242.  
  243.  
  244. //    ]]></SCRIPT>
  245.   </Item>
  246.  
  247. <Item CLASS="TextData" TYPE="TEXT" ID="3">
  248.     <Icon STRING="+44 0 181 123 2345"/>
  249.     <FileName SRC="valid.js"/>
  250.     <OnBlur VALUE="checkInternationalPhone(this)"/>
  251.     <Title><![CDATA[<B><I>International phone numbers</I></B>]]></Title>
  252.     <Description><![CDATA[This field will accept any combination of (only) numbers, hyphens and spaces, with or without a leading "+" sign.</P>]]></Description>
  253.  
  254.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  255.     var src, dest, attr, defval;
  256.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  257.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  258.  
  259.     //modify the section below; it is unique to each validating form field
  260.  
  261.     function dropfxnow()
  262.         {
  263.         Selection.TypeText("Phone (Int.): ");
  264.         Selection.InsertElement("INPUT");
  265.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  266.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","intphone");
  267.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkInternationalPhone(this)";
  268.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  269.         Application.FX.CopyFile(src,dst);
  270.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  271.         }
  272.  
  273.     //modify the section above; it is unique to each validating form field
  274.  
  275.     function istextcontainer()
  276.         {
  277.         var itsatext = 0;
  278.         itsatext = itsatext + Selection.IsParentElement("P");
  279.         itsatext = itsatext + Selection.IsParentElement("H1");
  280.         itsatext = itsatext + Selection.IsParentElement("H2");
  281.         itsatext = itsatext + Selection.IsParentElement("H3");
  282.         itsatext = itsatext + Selection.IsParentElement("H4");
  283.         itsatext = itsatext + Selection.IsParentElement("H5");
  284.         itsatext = itsatext + Selection.IsParentElement("H6");
  285.         itsatext = itsatext + Selection.IsParentElement("PRE");
  286.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  287.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  288.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  289.         itsatext = itsatext + Selection.IsParentElement("DD");
  290.         itsatext = itsatext + Selection.IsParentElement("DL");
  291.         itsatext = itsatext + Selection.IsParentElement("LI");
  292.         itsatext = itsatext + Selection.IsParentElement("LH");
  293.         itsatext = itsatext + Selection.IsParentElement("TD");
  294.         itsatext = itsatext + Selection.IsParentElement("TH");
  295.         return itsatext;
  296.         }
  297.  
  298.     function buildpath()
  299.         {
  300.         if (ActiveDocument.InCurrentProject)
  301.             {
  302.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  303.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  304.             }
  305.         else
  306.             {
  307.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  308.             attr = "scripts/%Filename%";
  309.             }
  310.         }
  311.  
  312.     function prepdrop()
  313.         {
  314.         var isittext;
  315.         Application.FX.SelectDropPoint();
  316.         if (Selection.IsParentElement("FORM") == true)
  317.             {
  318.             if (istextcontainer() == 0)
  319.                 {
  320.                 Application.FX.SelectDropPoint();
  321.                 Selection.InsertElement("P");
  322.                 dropfxnow();
  323.                 }
  324.             else
  325.                 {
  326.                 Application.FX.SelectDropPoint();
  327.                 dropfxnow();
  328.                 }
  329.             }                    
  330.         else
  331.             {
  332.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  333.             }
  334.         }
  335.  
  336.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  337.         {
  338.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  339.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  340.         }
  341.     else
  342.         {
  343.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  344.  
  345.         if (ans == 1)
  346.             {
  347.             ActiveDocument.SaveAs();
  348.             }
  349.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  350.             {
  351.             buildpath();
  352.             prepdrop();
  353.             }
  354.         }
  355.     
  356.  
  357. //    ]]></SCRIPT>
  358.   </Item>
  359.  
  360. <Item CLASS="TextData" TYPE="TEXT" ID="4">
  361.     <Icon STRING="09/15/1998"/>
  362.     <FileName SRC="valid.js"/>
  363.     <OnBlur VALUE="checkMDY(this)"/>
  364.     <Title><![CDATA[<B><I>Date (Y2K)</I></B>]]></Title>
  365.     <Description><![CDATA[This field will accept any real date >01/01/100 CE and <12/31/9999 CE in the form MMDDYYYY. It checks for Y2K (it adds 1900 to any year <100) and leap years.</P>]]></Description>
  366.  
  367.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  368.     var src, dest, attr, defval;
  369.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  370.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  371.  
  372.     //modify the section below; it is unique to each validating form field
  373.  
  374.     function dropfxnow()
  375.         {
  376.         Selection.TypeText("MM/DD/YYYY: ");
  377.         Selection.InsertElement("INPUT");
  378.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  379.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkMDY(this)";
  380.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","date");
  381.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  382.         Application.FX.CopyFile(src,dst);
  383.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  384.         }
  385.  
  386.     //modify the section above; it is unique to each validating form field
  387.  
  388.     function istextcontainer()
  389.         {
  390.         var itsatext = 0;
  391.         itsatext = itsatext + Selection.IsParentElement("P");
  392.         itsatext = itsatext + Selection.IsParentElement("H1");
  393.         itsatext = itsatext + Selection.IsParentElement("H2");
  394.         itsatext = itsatext + Selection.IsParentElement("H3");
  395.         itsatext = itsatext + Selection.IsParentElement("H4");
  396.         itsatext = itsatext + Selection.IsParentElement("H5");
  397.         itsatext = itsatext + Selection.IsParentElement("H6");
  398.         itsatext = itsatext + Selection.IsParentElement("PRE");
  399.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  400.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  401.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  402.         itsatext = itsatext + Selection.IsParentElement("DD");
  403.         itsatext = itsatext + Selection.IsParentElement("DL");
  404.         itsatext = itsatext + Selection.IsParentElement("LI");
  405.         itsatext = itsatext + Selection.IsParentElement("LH");
  406.         itsatext = itsatext + Selection.IsParentElement("TD");
  407.         itsatext = itsatext + Selection.IsParentElement("TH");
  408.         return itsatext;
  409.         }
  410.  
  411.     function buildpath()
  412.         {
  413.         if (ActiveDocument.InCurrentProject)
  414.             {
  415.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  416.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  417.             }
  418.         else
  419.             {
  420.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  421.             attr = "scripts/%Filename%";
  422.             }
  423.         }
  424.  
  425.     function prepdrop()
  426.         {
  427.         var isittext;
  428.         Application.FX.SelectDropPoint();
  429.         if (Selection.IsParentElement("FORM") == true)
  430.             {
  431.             if (istextcontainer() == 0)
  432.                 {
  433.                 Application.FX.SelectDropPoint();
  434.                 Selection.InsertElement("P");
  435.                 dropfxnow();
  436.                 }
  437.             else
  438.                 {
  439.                 Application.FX.SelectDropPoint();
  440.                 dropfxnow();
  441.                 }
  442.             }                    
  443.         else
  444.             {
  445.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  446.             }
  447.         }
  448.  
  449.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  450.         {
  451.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  452.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  453.         }
  454.     else
  455.         {
  456.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  457.  
  458.         if (ans == 1)
  459.             {
  460.             ActiveDocument.SaveAs();
  461.             }
  462.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  463.             {
  464.             buildpath();
  465.             prepdrop();
  466.             }
  467.         }
  468.  
  469. //    ]]></SCRIPT>
  470.   </Item>
  471.  
  472.  
  473.  
  474.  
  475. <Item CLASS="TextData" TYPE="TEXT" ID="5">
  476.     <Icon STRING="http://www.hmfx.com"/>
  477.     <FileName SRC="valid.js"/>
  478.     <OnBlur VALUE="checkURL(this)"/>
  479.     <Title><![CDATA[<B><I>Web URL</I></B>]]></Title>
  480.     <Description><![CDATA[This field will accept any URL that contains only alphanumeric characters, hyphen, underscore, and period. The TLD suffix must contain at least two characters. It will prepend "http://", if missing.</P>]]></Description>
  481.  
  482.  
  483.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  484.     var src, dest, attr, defval;
  485.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  486.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  487.  
  488.     //modify the section below; it is unique to each validating form field
  489.  
  490.     function dropfxnow()
  491.         {
  492.         Selection.TypeText("URL: ");
  493.         Selection.InsertElement("INPUT");
  494.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  495.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkURL(this)";
  496.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","url");
  497.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  498.         Application.FX.CopyFile(src,dst);
  499.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  500.         }
  501.  
  502.     //modify the section above; it is unique to each validating form field
  503.  
  504.     function istextcontainer()
  505.         {
  506.         var itsatext = 0;
  507.         itsatext = itsatext + Selection.IsParentElement("P");
  508.         itsatext = itsatext + Selection.IsParentElement("H1");
  509.         itsatext = itsatext + Selection.IsParentElement("H2");
  510.         itsatext = itsatext + Selection.IsParentElement("H3");
  511.         itsatext = itsatext + Selection.IsParentElement("H4");
  512.         itsatext = itsatext + Selection.IsParentElement("H5");
  513.         itsatext = itsatext + Selection.IsParentElement("H6");
  514.         itsatext = itsatext + Selection.IsParentElement("PRE");
  515.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  516.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  517.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  518.         itsatext = itsatext + Selection.IsParentElement("DD");
  519.         itsatext = itsatext + Selection.IsParentElement("DL");
  520.         itsatext = itsatext + Selection.IsParentElement("LI");
  521.         itsatext = itsatext + Selection.IsParentElement("LH");
  522.         itsatext = itsatext + Selection.IsParentElement("TD");
  523.         itsatext = itsatext + Selection.IsParentElement("TH");
  524.         return itsatext;
  525.         }
  526.  
  527.     function buildpath()
  528.         {
  529.         if (ActiveDocument.InCurrentProject)
  530.             {
  531.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  532.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  533.             }
  534.         else
  535.             {
  536.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  537.             attr = "scripts/%Filename%";
  538.             }
  539.         }
  540.  
  541.     function prepdrop()
  542.         {
  543.         var isittext;
  544.         Application.FX.SelectDropPoint();
  545.         if (Selection.IsParentElement("FORM") == true)
  546.             {
  547.             if (istextcontainer() == 0)
  548.                 {
  549.                 Application.FX.SelectDropPoint();
  550.                 Selection.InsertElement("P");
  551.                 dropfxnow();
  552.                 }
  553.             else
  554.                 {
  555.                 Application.FX.SelectDropPoint();
  556.                 dropfxnow();
  557.                 }
  558.             }                    
  559.         else
  560.             {
  561.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  562.             }
  563.         }
  564.  
  565.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  566.         {
  567.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  568.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  569.         }
  570.     else
  571.         {
  572.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  573.  
  574.         if (ans == 1)
  575.             {
  576.             ActiveDocument.SaveAs();
  577.             }
  578.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  579.             {
  580.             buildpath();
  581.             prepdrop();
  582.             }
  583.         }
  584.     
  585. //    ]]></SCRIPT>
  586.  
  587.   </Item>
  588.  
  589. <Item CLASS="TextData" TYPE="TEXT" ID="6">
  590.     <Icon STRING="123 Elm Street"/>
  591.     <OnBlur VALUE="checkAddress(this)"/>
  592.     <FileName SRC="valid.js"/>
  593.     <Title><![CDATA[<B><I>Street Address</I></B>]]></Title>
  594.     <Description><![CDATA[Will accept only alpha-numeric, whitespace, "/", "-", ".", and ",".</P>]]></Description>
  595.  
  596.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  597.     var src, dest, attr, defval;
  598.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  599.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  600.  
  601.     //modify the section below; it is unique to each validating form field
  602.  
  603.     function dropfxnow()
  604.         {
  605.         Selection.TypeText("Street Address: ");
  606.         Selection.InsertElement("INPUT");
  607.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  608.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkAddress(this)";
  609.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","staddr");
  610.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  611.         Application.FX.CopyFile(src,dst);
  612.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  613.         }
  614.  
  615.     //modify the section above; it is unique to each validating form field
  616.  
  617.     function istextcontainer()
  618.         {
  619.         var itsatext = 0;
  620.         itsatext = itsatext + Selection.IsParentElement("P");
  621.         itsatext = itsatext + Selection.IsParentElement("H1");
  622.         itsatext = itsatext + Selection.IsParentElement("H2");
  623.         itsatext = itsatext + Selection.IsParentElement("H3");
  624.         itsatext = itsatext + Selection.IsParentElement("H4");
  625.         itsatext = itsatext + Selection.IsParentElement("H5");
  626.         itsatext = itsatext + Selection.IsParentElement("H6");
  627.         itsatext = itsatext + Selection.IsParentElement("PRE");
  628.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  629.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  630.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  631.         itsatext = itsatext + Selection.IsParentElement("DD");
  632.         itsatext = itsatext + Selection.IsParentElement("DL");
  633.         itsatext = itsatext + Selection.IsParentElement("LI");
  634.         itsatext = itsatext + Selection.IsParentElement("LH");
  635.         itsatext = itsatext + Selection.IsParentElement("TD");
  636.         itsatext = itsatext + Selection.IsParentElement("TH");
  637.         return itsatext;
  638.         }
  639.  
  640.     function buildpath()
  641.         {
  642.         if (ActiveDocument.InCurrentProject)
  643.             {
  644.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  645.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  646.             }
  647.         else
  648.             {
  649.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  650.             attr = "scripts/%Filename%";
  651.             }
  652.         }
  653.  
  654.     function prepdrop()
  655.         {
  656.         var isittext;
  657.         Application.FX.SelectDropPoint();
  658.         if (Selection.IsParentElement("FORM") == true)
  659.             {
  660.             if (istextcontainer() == 0)
  661.                 {
  662.                 Application.FX.SelectDropPoint();
  663.                 Selection.InsertElement("P");
  664.                 dropfxnow();
  665.                 }
  666.             else
  667.                 {
  668.                 Application.FX.SelectDropPoint();
  669.                 dropfxnow();
  670.                 }
  671.             }                    
  672.         else
  673.             {
  674.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  675.             }
  676.         }
  677.  
  678.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  679.         {
  680.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  681.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  682.         }
  683.     else
  684.         {
  685.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  686.  
  687.         if (ans == 1)
  688.             {
  689.             ActiveDocument.SaveAs();
  690.             }
  691.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  692.             {
  693.             buildpath();
  694.             prepdrop();
  695.             }
  696.         }
  697.     
  698. //    ]]></SCRIPT>
  699.  
  700.   </Item>
  701.  
  702. <Item CLASS="TextData" TYPE="TEXT" ID="7">
  703.     <Icon STRING="John"/>
  704.     <FileName SRC="valid.js"/>
  705.     <OnBlur VALUE="checkName(this)"/>
  706.     <Title><![CDATA[<B><I>First Name</I></B>]]></Title>
  707.     <Description><![CDATA[Will accept alpha, period, hyphen and space. Coverts to Title Case.</P>]]></Description>
  708.  
  709.  
  710.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  711.     var src, dest, attr, defval;
  712.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  713.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  714.  
  715.     function dropfxnow()
  716.         {
  717.         Selection.TypeText("First Name: ");
  718.         Selection.InsertElement("INPUT");
  719.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  720.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkName(this)";
  721.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","fname");
  722.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  723.         Application.FX.CopyFile(src,dst);
  724.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  725.         }
  726.  
  727.     function istextcontainer()
  728.         {
  729.         var itsatext = 0;
  730.         itsatext = itsatext + Selection.IsParentElement("P");
  731.         itsatext = itsatext + Selection.IsParentElement("H1");
  732.         itsatext = itsatext + Selection.IsParentElement("H2");
  733.         itsatext = itsatext + Selection.IsParentElement("H3");
  734.         itsatext = itsatext + Selection.IsParentElement("H4");
  735.         itsatext = itsatext + Selection.IsParentElement("H5");
  736.         itsatext = itsatext + Selection.IsParentElement("H6");
  737.         itsatext = itsatext + Selection.IsParentElement("PRE");
  738.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  739.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  740.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  741.         itsatext = itsatext + Selection.IsParentElement("DD");
  742.         itsatext = itsatext + Selection.IsParentElement("DL");
  743.         itsatext = itsatext + Selection.IsParentElement("LI");
  744.         itsatext = itsatext + Selection.IsParentElement("LH");
  745.         itsatext = itsatext + Selection.IsParentElement("TD");
  746.         itsatext = itsatext + Selection.IsParentElement("TH");
  747.         return itsatext;
  748.         }
  749.  
  750.     function buildpath()
  751.         {
  752.         if (ActiveDocument.InCurrentProject)
  753.             {
  754.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  755.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  756.             }
  757.         else
  758.             {
  759.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  760.             attr = "scripts/%Filename%";
  761.             }
  762.         }
  763.  
  764.     function prepdrop()
  765.         {
  766.         var isittext;
  767.         Application.FX.SelectDropPoint();
  768.         if (Selection.IsParentElement("FORM") == true)
  769.             {
  770.             if (istextcontainer() == 0)
  771.                 {
  772.                 Application.FX.SelectDropPoint();
  773.                 Selection.InsertElement("P");
  774.                 dropfxnow();
  775.                 }
  776.             else
  777.                 {
  778.                 Application.FX.SelectDropPoint();
  779.                 dropfxnow();
  780.                 }
  781.             }                    
  782.         else
  783.             {
  784.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  785.             }
  786.         }
  787.  
  788.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  789.         {
  790.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  791.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  792.         }
  793.     else
  794.         {
  795.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  796.  
  797.         if (ans == 1)
  798.             {
  799.             ActiveDocument.SaveAs();
  800.             }
  801.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  802.             {
  803.             buildpath();
  804.             prepdrop();
  805.             }
  806.         }
  807.     
  808. //    ]]></SCRIPT>
  809.  
  810.   </Item>
  811.  
  812. <Item CLASS="TextData" TYPE="TEXT" ID="8">
  813.     <Icon STRING="W."/>
  814.     <OnBlur VALUE="checkName(this)"/>
  815.     <FileName SRC="valid.js"/>
  816.     <Title><![CDATA[<B><I>Middle Name/Initial</I></B>]]></Title>
  817.     <Description><![CDATA[Will accept alpha, period, hyphen and space. Coverts to Title Case.</P>]]></Description>
  818.  
  819.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  820.     var src, dest, attr, defval;
  821.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  822.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  823.  
  824.     //modify the section below; it is unique to each validating form field
  825.  
  826.     function dropfxnow()
  827.         {
  828.         Selection.TypeText("Middle: ");
  829.         Selection.InsertElement("INPUT");
  830.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  831.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkName(this)";
  832.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","mname");
  833.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  834.         Application.FX.CopyFile(src,dst);
  835.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  836.         }
  837.  
  838.     //modify the section above; it is unique to each validating form field
  839.  
  840.     function istextcontainer()
  841.         {
  842.         var itsatext = 0;
  843.         itsatext = itsatext + Selection.IsParentElement("P");
  844.         itsatext = itsatext + Selection.IsParentElement("H1");
  845.         itsatext = itsatext + Selection.IsParentElement("H2");
  846.         itsatext = itsatext + Selection.IsParentElement("H3");
  847.         itsatext = itsatext + Selection.IsParentElement("H4");
  848.         itsatext = itsatext + Selection.IsParentElement("H5");
  849.         itsatext = itsatext + Selection.IsParentElement("H6");
  850.         itsatext = itsatext + Selection.IsParentElement("PRE");
  851.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  852.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  853.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  854.         itsatext = itsatext + Selection.IsParentElement("DD");
  855.         itsatext = itsatext + Selection.IsParentElement("DL");
  856.         itsatext = itsatext + Selection.IsParentElement("LI");
  857.         itsatext = itsatext + Selection.IsParentElement("LH");
  858.         itsatext = itsatext + Selection.IsParentElement("TD");
  859.         itsatext = itsatext + Selection.IsParentElement("TH");
  860.         return itsatext;
  861.         }
  862.  
  863.     function buildpath()
  864.         {
  865.         if (ActiveDocument.InCurrentProject)
  866.             {
  867.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  868.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  869.             }
  870.         else
  871.             {
  872.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  873.             attr = "scripts/%Filename%";
  874.             }
  875.         }
  876.  
  877.     function prepdrop()
  878.         {
  879.         var isittext;
  880.         Application.FX.SelectDropPoint();
  881.         if (Selection.IsParentElement("FORM") == true)
  882.             {
  883.             if (istextcontainer() == 0)
  884.                 {
  885.                 Application.FX.SelectDropPoint();
  886.                 Selection.InsertElement("P");
  887.                 dropfxnow();
  888.                 }
  889.             else
  890.                 {
  891.                 Application.FX.SelectDropPoint();
  892.                 dropfxnow();
  893.                 }
  894.             }                    
  895.         else
  896.             {
  897.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  898.             }
  899.         }
  900.  
  901.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  902.         {
  903.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  904.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  905.         }
  906.     else
  907.         {
  908.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  909.  
  910.         if (ans == 1)
  911.             {
  912.             ActiveDocument.SaveAs();
  913.             }
  914.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  915.             {
  916.             buildpath();
  917.             prepdrop();
  918.             }
  919.         }
  920.     
  921.  
  922. //    ]]></SCRIPT>
  923.  
  924.  
  925.  
  926.   </Item>
  927.  
  928. <Item CLASS="TextData" TYPE="TEXT" ID="9">
  929.     <Icon STRING="Smith"/>
  930.     <FileName SRC="valid.js"/>
  931.     <OnBlur VALUE="checkName(this)"/>
  932.     <Title><![CDATA[<B><I>Last Name</I></B>]]></Title>
  933.     <Description><![CDATA[Will accept alpha, period, hyphen and space. Coverts to Title Case.</P>]]></Description>
  934.  
  935.  
  936.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  937.     var src, dest, attr, defval;
  938.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  939.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  940.  
  941.     //modify the section below; it is unique to each validating form field
  942.  
  943.     function dropfxnow()
  944.         {
  945.         Selection.TypeText("Last Name: ");
  946.         Selection.InsertElement("INPUT");
  947.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  948.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkName(this)";
  949.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","lname");
  950.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  951.         Application.FX.CopyFile(src,dst);
  952.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  953.         }
  954.  
  955.     //modify the section above; it is unique to each validating form field
  956.  
  957.     function istextcontainer()
  958.         {
  959.         var itsatext = 0;
  960.         itsatext = itsatext + Selection.IsParentElement("P");
  961.         itsatext = itsatext + Selection.IsParentElement("H1");
  962.         itsatext = itsatext + Selection.IsParentElement("H2");
  963.         itsatext = itsatext + Selection.IsParentElement("H3");
  964.         itsatext = itsatext + Selection.IsParentElement("H4");
  965.         itsatext = itsatext + Selection.IsParentElement("H5");
  966.         itsatext = itsatext + Selection.IsParentElement("H6");
  967.         itsatext = itsatext + Selection.IsParentElement("PRE");
  968.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  969.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  970.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  971.         itsatext = itsatext + Selection.IsParentElement("DD");
  972.         itsatext = itsatext + Selection.IsParentElement("DL");
  973.         itsatext = itsatext + Selection.IsParentElement("LI");
  974.         itsatext = itsatext + Selection.IsParentElement("LH");
  975.         itsatext = itsatext + Selection.IsParentElement("TD");
  976.         itsatext = itsatext + Selection.IsParentElement("TH");
  977.         return itsatext;
  978.         }
  979.  
  980.     function buildpath()
  981.         {
  982.         if (ActiveDocument.InCurrentProject)
  983.             {
  984.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  985.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  986.             }
  987.         else
  988.             {
  989.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  990.             attr = "scripts/%Filename%";
  991.             }
  992.         }
  993.  
  994.     function prepdrop()
  995.         {
  996.         var isittext;
  997.         Application.FX.SelectDropPoint();
  998.         if (Selection.IsParentElement("FORM") == true)
  999.             {
  1000.             if (istextcontainer() == 0)
  1001.                 {
  1002.                 Application.FX.SelectDropPoint();
  1003.                 Selection.InsertElement("P");
  1004.                 dropfxnow();
  1005.                 }
  1006.             else
  1007.                 {
  1008.                 Application.FX.SelectDropPoint();
  1009.                 dropfxnow();
  1010.                 }
  1011.             }                    
  1012.         else
  1013.             {
  1014.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  1015.             }
  1016.         }
  1017.  
  1018.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  1019.         {
  1020.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  1021.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  1022.         }
  1023.     else
  1024.         {
  1025.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  1026.  
  1027.         if (ans == 1)
  1028.             {
  1029.             ActiveDocument.SaveAs();
  1030.             }
  1031.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  1032.             {
  1033.             buildpath();
  1034.             prepdrop();
  1035.             }
  1036.         }
  1037.  
  1038. //    ]]></SCRIPT>
  1039.  
  1040.  
  1041.   </Item>
  1042.  
  1043. <Item CLASS="TextData" TYPE="TEXT" ID="10">
  1044.     <Icon STRING="90210"/>
  1045.     <FileName SRC="valid.js"/>
  1046.     <OnBlur VALUE="checkZIPCode(this)"/>
  1047.     <Title><![CDATA[<B><I>Zip Code</I></B>]]></Title>
  1048.     <Description><![CDATA[Will accept 5 or 9 digit Zip codes. Reformats 9-digit codes with a delimiter.</P>]]></Description>
  1049.  
  1050.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  1051.     var src, dest, attr, defval;
  1052.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  1053.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  1054.  
  1055.     //modify the section below; it is unique to each validating form field
  1056.  
  1057.     function dropfxnow()
  1058.         {
  1059.         Selection.TypeText("Zip: ");
  1060.         Selection.InsertElement("INPUT");
  1061.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  1062.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkZIPCode(this)";
  1063.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","zip");
  1064.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  1065.         Application.FX.CopyFile(src,dst);
  1066.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  1067.         }
  1068.  
  1069.     //modify the section above; it is unique to each validating form field
  1070.  
  1071.     function istextcontainer()
  1072.         {
  1073.         var itsatext = 0;
  1074.         itsatext = itsatext + Selection.IsParentElement("P");
  1075.         itsatext = itsatext + Selection.IsParentElement("H1");
  1076.         itsatext = itsatext + Selection.IsParentElement("H2");
  1077.         itsatext = itsatext + Selection.IsParentElement("H3");
  1078.         itsatext = itsatext + Selection.IsParentElement("H4");
  1079.         itsatext = itsatext + Selection.IsParentElement("H5");
  1080.         itsatext = itsatext + Selection.IsParentElement("H6");
  1081.         itsatext = itsatext + Selection.IsParentElement("PRE");
  1082.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  1083.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  1084.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  1085.         itsatext = itsatext + Selection.IsParentElement("DD");
  1086.         itsatext = itsatext + Selection.IsParentElement("DL");
  1087.         itsatext = itsatext + Selection.IsParentElement("LI");
  1088.         itsatext = itsatext + Selection.IsParentElement("LH");
  1089.         itsatext = itsatext + Selection.IsParentElement("TD");
  1090.         itsatext = itsatext + Selection.IsParentElement("TH");
  1091.         return itsatext;
  1092.         }
  1093.  
  1094.     function buildpath()
  1095.         {
  1096.         if (ActiveDocument.InCurrentProject)
  1097.             {
  1098.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  1099.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  1100.             }
  1101.         else
  1102.             {
  1103.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  1104.             attr = "scripts/%Filename%";
  1105.             }
  1106.         }
  1107.  
  1108.     function prepdrop()
  1109.         {
  1110.         var isittext;
  1111.         Application.FX.SelectDropPoint();
  1112.         if (Selection.IsParentElement("FORM") == true)
  1113.             {
  1114.             if (istextcontainer() == 0)
  1115.                 {
  1116.                 Application.FX.SelectDropPoint();
  1117.                 Selection.InsertElement("P");
  1118.                 dropfxnow();
  1119.                 }
  1120.             else
  1121.                 {
  1122.                 Application.FX.SelectDropPoint();
  1123.                 dropfxnow();
  1124.                 }
  1125.             }                    
  1126.         else
  1127.             {
  1128.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  1129.             }
  1130.         }
  1131.  
  1132.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  1133.         {
  1134.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  1135.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  1136.         }
  1137.     else
  1138.         {
  1139.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  1140.  
  1141.         if (ans == 1)
  1142.             {
  1143.             ActiveDocument.SaveAs();
  1144.             }
  1145.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  1146.             {
  1147.             buildpath();
  1148.             prepdrop();
  1149.             }
  1150.         }
  1151.  
  1152.  
  1153.  
  1154. //    ]]></SCRIPT>
  1155.   </Item>
  1156.  
  1157. <Item CLASS="TextData" TYPE="TEXT" ID="11">
  1158.     <Icon STRING="M4R 1K8"/>
  1159.     <FileName SRC="valid.js"/>
  1160.     <OnBlur VALUE="checkPostalCode(this)"/>
  1161.     <Title><![CDATA[<B><I>Canadian Postal Code</I></B>]]></Title>
  1162.     <Description><![CDATA[Accepts a Canadian Postal Code. Checks for proper alternation of numbers and digits; Reformats to uppercase, with a space.]]></Description>
  1163.  
  1164.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  1165.     var src, dest, attr, defval;
  1166.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  1167.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  1168.  
  1169.     //modify the section below; it is unique to each validating form field
  1170.  
  1171.     function dropfxnow()
  1172.         {
  1173.         Selection.TypeText("Postal Code: ");
  1174.         Selection.InsertElement("INPUT");
  1175.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  1176.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkPostalCode(this)";
  1177.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","pcode");
  1178.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  1179.         Application.FX.CopyFile(src,dst);
  1180.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  1181.         }
  1182.  
  1183.     //modify the section above; it is unique to each validating form field
  1184.  
  1185.     function istextcontainer()
  1186.         {
  1187.         var itsatext = 0;
  1188.         itsatext = itsatext + Selection.IsParentElement("P");
  1189.         itsatext = itsatext + Selection.IsParentElement("H1");
  1190.         itsatext = itsatext + Selection.IsParentElement("H2");
  1191.         itsatext = itsatext + Selection.IsParentElement("H3");
  1192.         itsatext = itsatext + Selection.IsParentElement("H4");
  1193.         itsatext = itsatext + Selection.IsParentElement("H5");
  1194.         itsatext = itsatext + Selection.IsParentElement("H6");
  1195.         itsatext = itsatext + Selection.IsParentElement("PRE");
  1196.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  1197.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  1198.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  1199.         itsatext = itsatext + Selection.IsParentElement("DD");
  1200.         itsatext = itsatext + Selection.IsParentElement("DL");
  1201.         itsatext = itsatext + Selection.IsParentElement("LI");
  1202.         itsatext = itsatext + Selection.IsParentElement("LH");
  1203.         itsatext = itsatext + Selection.IsParentElement("TD");
  1204.         itsatext = itsatext + Selection.IsParentElement("TH");
  1205.         return itsatext;
  1206.         }
  1207.  
  1208.     function buildpath()
  1209.         {
  1210.         if (ActiveDocument.InCurrentProject)
  1211.             {
  1212.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  1213.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  1214.             }
  1215.         else
  1216.             {
  1217.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  1218.             attr = "scripts/%Filename%";
  1219.             }
  1220.         }
  1221.  
  1222.     function prepdrop()
  1223.         {
  1224.         var isittext;
  1225.         Application.FX.SelectDropPoint();
  1226.         if (Selection.IsParentElement("FORM") == true)
  1227.             {
  1228.             if (istextcontainer() == 0)
  1229.                 {
  1230.                 Application.FX.SelectDropPoint();
  1231.                 Selection.InsertElement("P");
  1232.                 dropfxnow();
  1233.                 }
  1234.             else
  1235.                 {
  1236.                 Application.FX.SelectDropPoint();
  1237.                 dropfxnow();
  1238.                 }
  1239.             }                    
  1240.         else
  1241.             {
  1242.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  1243.             }
  1244.         }
  1245.  
  1246.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  1247.         {
  1248.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  1249.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  1250.         }
  1251.     else
  1252.         {
  1253.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  1254.  
  1255.         if (ans == 1)
  1256.             {
  1257.             ActiveDocument.SaveAs();
  1258.             }
  1259.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  1260.             {
  1261.             buildpath();
  1262.             prepdrop();
  1263.             }
  1264.         }
  1265.     
  1266. //    ]]></SCRIPT>
  1267.  
  1268.  
  1269.  
  1270.   </Item>
  1271.  
  1272. <Item CLASS="TextData" TYPE="TEXT" ID="12">
  1273.     <Icon STRING="NY"/>
  1274.     <FileName SRC="valid.js"/>
  1275.     <OnBlur VALUE="checkStateCode(this)"/>
  1276.     <Title><![CDATA[<B><I>State Code</I></B>]]></Title>
  1277.     <Description><![CDATA[Accepts any US State Code.]]></Description>
  1278.  
  1279.  
  1280.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  1281.     var src, dest, attr, defval;
  1282.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  1283.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  1284.  
  1285.     //modify the section below; it is unique to each validating form field
  1286.  
  1287.     function dropfxnow()
  1288.         {
  1289.         Selection.TypeText("State: ");
  1290.         Selection.InsertElement("INPUT");
  1291.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  1292.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkStateCode(this)";
  1293.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","state");
  1294.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  1295.         Selection.ElementAttribute("SIZE","INPUT") = "3";
  1296.         Application.FX.CopyFile(src,dst);
  1297.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  1298.         }
  1299.  
  1300.     //modify the section above; it is unique to each validating form field
  1301.  
  1302.     function istextcontainer()
  1303.         {
  1304.         var itsatext = 0;
  1305.         itsatext = itsatext + Selection.IsParentElement("P");
  1306.         itsatext = itsatext + Selection.IsParentElement("H1");
  1307.         itsatext = itsatext + Selection.IsParentElement("H2");
  1308.         itsatext = itsatext + Selection.IsParentElement("H3");
  1309.         itsatext = itsatext + Selection.IsParentElement("H4");
  1310.         itsatext = itsatext + Selection.IsParentElement("H5");
  1311.         itsatext = itsatext + Selection.IsParentElement("H6");
  1312.         itsatext = itsatext + Selection.IsParentElement("PRE");
  1313.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  1314.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  1315.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  1316.         itsatext = itsatext + Selection.IsParentElement("DD");
  1317.         itsatext = itsatext + Selection.IsParentElement("DL");
  1318.         itsatext = itsatext + Selection.IsParentElement("LI");
  1319.         itsatext = itsatext + Selection.IsParentElement("LH");
  1320.         itsatext = itsatext + Selection.IsParentElement("TD");
  1321.         itsatext = itsatext + Selection.IsParentElement("TH");
  1322.         return itsatext;
  1323.         }
  1324.  
  1325.     function buildpath()
  1326.         {
  1327.         if (ActiveDocument.InCurrentProject)
  1328.             {
  1329.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  1330.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  1331.             }
  1332.         else
  1333.             {
  1334.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  1335.             attr = "scripts/%Filename%";
  1336.             }
  1337.         }
  1338.  
  1339.     function prepdrop()
  1340.         {
  1341.         var isittext;
  1342.         Application.FX.SelectDropPoint();
  1343.         if (Selection.IsParentElement("FORM") == true)
  1344.             {
  1345.             if (istextcontainer() == 0)
  1346.                 {
  1347.                 Application.FX.SelectDropPoint();
  1348.                 Selection.InsertElement("P");
  1349.                 dropfxnow();
  1350.                 }
  1351.             else
  1352.                 {
  1353.                 Application.FX.SelectDropPoint();
  1354.                 dropfxnow();
  1355.                 }
  1356.             }                    
  1357.         else
  1358.             {
  1359.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  1360.             }
  1361.         }
  1362.  
  1363.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  1364.         {
  1365.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  1366.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  1367.         }
  1368.     else
  1369.         {
  1370.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  1371.  
  1372.         if (ans == 1)
  1373.             {
  1374.             ActiveDocument.SaveAs();
  1375.             }
  1376.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  1377.             {
  1378.             buildpath();
  1379.             prepdrop();
  1380.             }
  1381.         }
  1382.     
  1383.  
  1384.  
  1385. //    ]]></SCRIPT>
  1386.  
  1387.   </Item>
  1388.  
  1389. <Item CLASS="TextData" TYPE="TEXT" ID="13">
  1390.     <Icon STRING="ON"/>
  1391.     <FileName SRC="valid.js"/>
  1392.     <OnBlur VALUE="checkProvinceCode(this)"/>
  1393.     <Title><![CDATA[<B><I>Canadian Province Code</I></B>]]></Title>
  1394.     <Description><![CDATA[Accepts any valid Province or Territory Code.]]></Description>
  1395.  
  1396.  
  1397.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  1398.     var src, dest, attr, defval;
  1399.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  1400.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  1401.  
  1402.     //modify the section below; it is unique to each validating form field
  1403.  
  1404.     function dropfxnow()
  1405.         {
  1406.         Selection.TypeText("State: ");
  1407.         Selection.InsertElement("INPUT");
  1408.         Selection.ElementAttribute("TYPE","INPUT") = "TEXT";
  1409.         Selection.ElementAttribute("ONBLUR","INPUT") = "checkProvinceCode(this)";
  1410.         Selection.ElementAttribute("NAME","INPUT") = ActiveDocument.UniqueAttributeValue("NAME","prov");
  1411.         Selection.ElementAttribute("VALUE","INPUT") = defval;
  1412.         Selection.ElementAttribute("SIZE","INPUT") = "3";
  1413.         Application.FX.CopyFile(src,dst);
  1414.         Application.FX.HTML("<SCRIPT SRC='" + attr + "' ID='sqValidator' LANGUAGE='JavaScript'></SCRIPT>","","HEAD","sqValidator");
  1415.         }
  1416.  
  1417.     //modify the section above; it is unique to each validating form field
  1418.  
  1419.     function istextcontainer()
  1420.         {
  1421.         var itsatext = 0;
  1422.         itsatext = itsatext + Selection.IsParentElement("P");
  1423.         itsatext = itsatext + Selection.IsParentElement("H1");
  1424.         itsatext = itsatext + Selection.IsParentElement("H2");
  1425.         itsatext = itsatext + Selection.IsParentElement("H3");
  1426.         itsatext = itsatext + Selection.IsParentElement("H4");
  1427.         itsatext = itsatext + Selection.IsParentElement("H5");
  1428.         itsatext = itsatext + Selection.IsParentElement("H6");
  1429.         itsatext = itsatext + Selection.IsParentElement("PRE");
  1430.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  1431.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  1432.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  1433.         itsatext = itsatext + Selection.IsParentElement("DD");
  1434.         itsatext = itsatext + Selection.IsParentElement("DL");
  1435.         itsatext = itsatext + Selection.IsParentElement("LI");
  1436.         itsatext = itsatext + Selection.IsParentElement("LH");
  1437.         itsatext = itsatext + Selection.IsParentElement("TD");
  1438.         itsatext = itsatext + Selection.IsParentElement("TH");
  1439.         return itsatext;
  1440.         }
  1441.  
  1442.     function buildpath()
  1443.         {
  1444.         if (ActiveDocument.InCurrentProject)
  1445.             {
  1446.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  1447.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  1448.             }
  1449.         else
  1450.             {
  1451.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  1452.             attr = "scripts/%Filename%";
  1453.             }
  1454.         }
  1455.  
  1456.     function prepdrop()
  1457.         {
  1458.         var isittext;
  1459.         Application.FX.SelectDropPoint();
  1460.         if (Selection.IsParentElement("FORM") == true)
  1461.             {
  1462.             if (istextcontainer() == 0)
  1463.                 {
  1464.                 Application.FX.SelectDropPoint();
  1465.                 Selection.InsertElement("P");
  1466.                 dropfxnow();
  1467.                 }
  1468.             else
  1469.                 {
  1470.                 Application.FX.SelectDropPoint();
  1471.                 dropfxnow();
  1472.                 }
  1473.             }                    
  1474.         else
  1475.             {
  1476.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  1477.             }
  1478.         }
  1479.  
  1480.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  1481.         {
  1482.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  1483.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  1484.         }
  1485.     else
  1486.         {
  1487.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  1488.  
  1489.         if (ans == 1)
  1490.             {
  1491.             ActiveDocument.SaveAs();
  1492.             }
  1493.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  1494.             {
  1495.             buildpath();
  1496.             prepdrop();
  1497.             }
  1498.         }
  1499.     
  1500.  
  1501.  
  1502. //    ]]></SCRIPT>
  1503.  
  1504.   </Item>
  1505.  
  1506. <Item CLASS="TextData" TYPE="TEXT" ID="14">
  1507.     <Icon STRING="North American States / Province List"/>
  1508.     <FileName SRC="valid.js"/>
  1509.     <OnBlur VALUE=""/>
  1510.     <Title><![CDATA[<B>Drop Down State/Province List</B>]]></Title>
  1511.     <Description><![CDATA[This will insert a drop-down list of all US state names and Canadian province names, and pass the standard 2 letter abbreviation to the form script.]]></Description>
  1512.  
  1513.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  1514.     var src, dest, attr, defval;
  1515.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  1516.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  1517.  
  1518.     //modify the section below; it is unique to each validating form field
  1519.  
  1520.     function dropfxnow()
  1521.         {
  1522.         Application.FX.HTML("","%Pathname%statesandprovinces.txt");
  1523.         }
  1524.  
  1525.     //modify the section above; it is unique to each validating form field
  1526.  
  1527.     function istextcontainer()
  1528.         {
  1529.         var itsatext = 0;
  1530.         itsatext = itsatext + Selection.IsParentElement("P");
  1531.         itsatext = itsatext + Selection.IsParentElement("H1");
  1532.         itsatext = itsatext + Selection.IsParentElement("H2");
  1533.         itsatext = itsatext + Selection.IsParentElement("H3");
  1534.         itsatext = itsatext + Selection.IsParentElement("H4");
  1535.         itsatext = itsatext + Selection.IsParentElement("H5");
  1536.         itsatext = itsatext + Selection.IsParentElement("H6");
  1537.         itsatext = itsatext + Selection.IsParentElement("PRE");
  1538.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  1539.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  1540.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  1541.         itsatext = itsatext + Selection.IsParentElement("DD");
  1542.         itsatext = itsatext + Selection.IsParentElement("DL");
  1543.         itsatext = itsatext + Selection.IsParentElement("LI");
  1544.         itsatext = itsatext + Selection.IsParentElement("LH");
  1545.         itsatext = itsatext + Selection.IsParentElement("TD");
  1546.         itsatext = itsatext + Selection.IsParentElement("TH");
  1547.         return itsatext;
  1548.         }
  1549.  
  1550.     function buildpath()
  1551.         {
  1552.         if (ActiveDocument.InCurrentProject)
  1553.             {
  1554.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  1555.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  1556.             }
  1557.         else
  1558.             {
  1559.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  1560.             attr = "scripts/%Filename%";
  1561.             }
  1562.         }
  1563.  
  1564.     function prepdrop()
  1565.         {
  1566.         var isittext;
  1567.         Application.FX.SelectDropPoint();
  1568.         if (Selection.IsParentElement("FORM") == true)
  1569.             {
  1570.             if (istextcontainer() == 0)
  1571.                 {
  1572.                 Application.FX.SelectDropPoint();
  1573.                 Selection.InsertElement("P");
  1574.                 dropfxnow();
  1575.                 }
  1576.             else
  1577.                 {
  1578.                 Application.FX.SelectDropPoint();
  1579.                 dropfxnow();
  1580.                 }
  1581.             }                    
  1582.         else
  1583.             {
  1584.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  1585.             }
  1586.         }
  1587.  
  1588.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  1589.         {
  1590.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  1591.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  1592.         }
  1593.     else
  1594.         {
  1595.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  1596.  
  1597.         if (ans == 1)
  1598.             {
  1599.             ActiveDocument.SaveAs();
  1600.             }
  1601.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  1602.             {
  1603.             buildpath();
  1604.             prepdrop();
  1605.             }
  1606.         }
  1607.     
  1608.  
  1609.  
  1610. //    ]]></SCRIPT>
  1611.  
  1612.  
  1613.   </Item>
  1614.  
  1615.  
  1616. <Item CLASS="TextData" TYPE="TEXT" ID="15">
  1617.     <Icon STRING="Country Code Dropdown List"/>
  1618.     <FileName SRC="valid.js"/>
  1619.     <OnBlur VALUE=""/>
  1620.     <Title><![CDATA[<B>Drop Down Country List</B>]]></Title>
  1621.     <Description><![CDATA[This will insert a drop-down list of country names, and pass the standard 2 letter abbreviation to the form script.]]></Description>
  1622.  
  1623.     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
  1624.     var src, dest, attr, defval;
  1625.     src = "%Pathname%" + "%thisItem.SQ_getChildAttribute(Filename, 0, SRC)%";
  1626.     defval = "%thisItem.SQ_getChildAttribute(Icon, 0, STRING)%";
  1627.  
  1628.     //modify the section below; it is unique to each validating form field
  1629.  
  1630.     function dropfxnow()
  1631.         {
  1632.         Application.FX.HTML("","%Pathname%countries.txt");
  1633.         }
  1634.  
  1635.     //modify the section above; it is unique to each validating form field
  1636.  
  1637.     function istextcontainer()
  1638.         {
  1639.         var itsatext = 0;
  1640.         itsatext = itsatext + Selection.IsParentElement("P");
  1641.         itsatext = itsatext + Selection.IsParentElement("H1");
  1642.         itsatext = itsatext + Selection.IsParentElement("H2");
  1643.         itsatext = itsatext + Selection.IsParentElement("H3");
  1644.         itsatext = itsatext + Selection.IsParentElement("H4");
  1645.         itsatext = itsatext + Selection.IsParentElement("H5");
  1646.         itsatext = itsatext + Selection.IsParentElement("H6");
  1647.         itsatext = itsatext + Selection.IsParentElement("PRE");
  1648.         itsatext = itsatext + Selection.IsParentElement("ADDRESS");
  1649.         itsatext = itsatext + Selection.IsParentElement("APPLET");
  1650.         itsatext = itsatext + Selection.IsParentElement("BLOCKQUOTE");
  1651.         itsatext = itsatext + Selection.IsParentElement("DD");
  1652.         itsatext = itsatext + Selection.IsParentElement("DL");
  1653.         itsatext = itsatext + Selection.IsParentElement("LI");
  1654.         itsatext = itsatext + Selection.IsParentElement("LH");
  1655.         itsatext = itsatext + Selection.IsParentElement("TD");
  1656.         itsatext = itsatext + Selection.IsParentElement("TH");
  1657.         return itsatext;
  1658.         }
  1659.  
  1660.     function buildpath()
  1661.         {
  1662.         if (ActiveDocument.InCurrentProject)
  1663.             {
  1664.             dst = Application.ProjectDirectory + "\\scripts\\%Filename%";
  1665.             attr = Application.PathToURL(dst, ActiveDocument.LocalPath + "/%Filename%");
  1666.             }
  1667.         else
  1668.             {
  1669.             dst = ActiveDocument.LocalPath + "\\scripts\\%Filename%";
  1670.             attr = "scripts/%Filename%";
  1671.             }
  1672.         }
  1673.  
  1674.     function prepdrop()
  1675.         {
  1676.         var isittext;
  1677.         Application.FX.SelectDropPoint();
  1678.         if (Selection.IsParentElement("FORM") == true)
  1679.             {
  1680.             if (istextcontainer() == 0)
  1681.                 {
  1682.                 Application.FX.SelectDropPoint();
  1683.                 Selection.InsertElement("P");
  1684.                 dropfxnow();
  1685.                 }
  1686.             else
  1687.                 {
  1688.                 Application.FX.SelectDropPoint();
  1689.                 dropfxnow();
  1690.                 }
  1691.             }                    
  1692.         else
  1693.             {
  1694.             ans = Application.MessageBox("Please drop the object inside a FORM element.", 0, "Client-Side Field Validator");
  1695.             }
  1696.         }
  1697.  
  1698.     if (ActiveDocument.LocalPath != "")     // First, check if the file is saved
  1699.         {
  1700.         buildpath(); //build the path to the external file based on whether or not document is part of open project
  1701.         prepdrop();  //determine whether or not it is legal to drop the form element at this location, or make it so
  1702.         }
  1703.     else
  1704.         {
  1705.         ans = Application.NoticeBox("Document must first be saved.", "Save now", null,"Cancel");
  1706.  
  1707.         if (ans == 1)
  1708.             {
  1709.             ActiveDocument.SaveAs();
  1710.             }
  1711.         if (ActiveDocument.LocalPath != "") //check again if they did indeed save and name file
  1712.             {
  1713.             buildpath();
  1714.             prepdrop();
  1715.             }
  1716.         }
  1717.     
  1718.  
  1719.  
  1720. //    ]]></SCRIPT>
  1721. </Item>
  1722.  
  1723. </Items>
  1724.